package com.rzl.expense.expense.service.impl;

import java.util.List;
import com.rzl.expense.common.utils.DateUtils;
import com.rzl.expense.expense.domain.RentContract;
import com.rzl.expense.expense.mapper.RentContractMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rzl.expense.system.service.IRentContractService;

/**
 * 房租合同Service业务层处理
 * 
 * @author expense
 * @date 2024-11-21
 */
@Service
public class RentContractServiceImpl implements IRentContractService 
{
    @Autowired
    private RentContractMapper rentContractMapper;

    /**
     * 查询房租合同
     * 
     * @param rentcontractId 房租合同主键
     * @return 房租合同
     */
    @Override
    public RentContract selectRentContractByRentcontractId(String rentcontractId)
    {
        return rentContractMapper.selectRentContractByRentcontractId(rentcontractId);
    }

    /**
     * 查询房租合同列表
     * 
     * @param rentContract 房租合同
     * @return 房租合同
     */
    @Override
    public List<RentContract> selectRentContractList(RentContract rentContract)
    {
        return rentContractMapper.selectRentContractList(rentContract);
    }

    /**
     * 新增房租合同
     * 
     * @param rentContract 房租合同
     * @return 结果
     */
    @Override
    public int insertRentContract(RentContract rentContract)
    {
        rentContract.setCreateTime(DateUtils.getNowDate());
        return rentContractMapper.insertRentContract(rentContract);
    }

    /**
     * 修改房租合同
     * 
     * @param rentContract 房租合同
     * @return 结果
     */
    @Override
    public int updateRentContract(RentContract rentContract)
    {
        rentContract.setUpdateTime(DateUtils.getNowDate());
        return rentContractMapper.updateRentContract(rentContract);
    }

    /**
     * 批量删除房租合同
     * 
     * @param rentcontractIds 需要删除的房租合同主键
     * @return 结果
     */
    @Override
    public int deleteRentContractByRentcontractIds(String[] rentcontractIds)
    {
        return rentContractMapper.deleteRentContractByRentcontractIds(rentcontractIds);
    }

    /**
     * 删除房租合同信息
     * 
     * @param rentcontractId 房租合同主键
     * @return 结果
     */
    @Override
    public int deleteRentContractByDate(String[] currentDate)
    {
        return rentContractMapper.deleteRentContractByDate(currentDate[0],currentDate[1]);
    }

    public void batchRentContract(List<RentContract> list){
        rentContractMapper.batchRentContract(list);
    }
}
